/**
 * @file Name: 6.cpp
 * @author: Fenghuwuyu
 * @version: 1.0
 * @brief:
 * @date: Sat 10 Apr 2021 04:02:42 AM PDT
 */

#include<iostream>
int main()

/**
 * when we design a class, we should consider that how to copy the class
 * here is a bad_copy below:
 * void bad_copy(Vecotr v1)
 * {
 *		Vector v2 = v1;
 * }
 *
 * but v1 and v2 is point to the same one, so if we delete the v1, v2 will point to nothing!
 *
 * so we must define a better copy. which have two members. a copy constructor and a copy assignment:
 *
 * class Vector
 * {
 *		private:
 *			double* elem;
 *			int sz;
 *		public:
 *			Vector(int s);
 *			~Vector(){delete [] elem;}
 *
 *			Vector(const Vector& a); // copy constructor
 *			Vector& operator=(const Vector& a); // copy assignment
 *
 * }
 * 
 * Vector::Vector(const Vector& a)
 *		:elem{new double[sz]}, sz{s,sz}
 *		{
 *			for(int i=0;i!=sz;++i)
 *				elem[i] = a.elem[i];
 *		}
 * Vector& Vector::operator=(const Vector& a)
 * {
 *		double* p = new double[a,sz];
 *		for(int i=0;i!=a.sz;i++)
 *			p[i] = a.elem[i];
 *		delete [] elem;
 *		elem = p;
 *		sz = a.sz;
 *		return *this;
 * }
 *
 * the keyword this is predefined in a member function and points to the object for which the member function is called.
 *
 *
